import Vue from "vue"
import VueRouter from "vue-router"
import About from "@/pages/About"
import Home from "@/pages/Home"
import Message from "@/pages/Message"
import News from "@/pages/News"
import Detail from "@/pages/Detail"

Vue.use(VueRouter)

export default new VueRouter({
    routes:[
        {
            path:'/about',
            component:About
        },
        {
            path:'/home',
            component:Home,
            children:[
                {
                    path:'message',
                    component:Message,
                    children:[
                        {
                            name:'detail',
                            path:'detail/:id/:title',
                            component:Detail,
                            //props配置(对象)
                            /*props:{a:1,b:'666'}*/
                            //props配置(布尔值)
                            /*props:true*/
                            //props配置(函数式)
                            props({params}){
                                return{
                                    id:params.id,
                                    title:params.title,
                                    a:1,
                                    b:666
                                }
                            }
                        }
                    ]
                },
                {
                    path:'news',
                    component:News
                }
            ]
        }
    ]
})